package com.thankcreate.model;

import java.io.IOException;
import java.net.URL;

import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;

import com.thankcreate.geekchat.Activator;


//import org.eclipse.core.resources.ResourcesPlugin;

public class ImageURL {
	
	public static final String NEW_CONTACT = "icons/add_contact.gif";
	
	public static final String OPEN_CONTACT_PAGE = "icons/chat.gif";
	
	public static int[] photoSum = {5, 3, 4};
	
	public static String parseTypeAndPhotoIndexToURL(int type,
			int photoINdex){
		URL temp1 = Activator.getDefault().getBundle().getResource("Images\\");
		URL temp2 = null;
		try {
			temp2 = FileLocator.toFileURL(temp1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		
		String resultString =temp2.getPath() + type + "_" + photoINdex + ".jpg";
		return resultString;
	}
	
	public static int getPhotoSumByType(int type){
		return photoSum[type];
	}
	
	public static String getImageURL(String name) {
		URL temp1 = Activator.getDefault().getBundle().getResource("Images\\");
		URL temp2 = null;
		try {
			temp2 = FileLocator.toFileURL(temp1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		
		return  temp2.getPath() + name;
		
	}
	
	public static String getMyPhotoURL(){
		URL temp1 = Activator.getDefault().getBundle().getResource("Images\\");
		URL temp2 = null;
		try {
			temp2 = FileLocator.toFileURL(temp1);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	
		
		return  temp2.getPath() + "9_0.jpg";
	}
}
